﻿@{
    ViewBag.Title = "Index";
    Layout = "~/Views/Shared/_ACEIndex.cshtml";
}


@this.Partial("Index-js")

<div class="topPanel">
    <div class="toolbar">
        <div class="btn-group">
            <a class="btn btn-primary" onclick="$ace.reload()"><span class="glyphicon glyphicon-refresh"></span></a>
        </div>
        <div class="btn-group">
            <button class="btn btn-primary" data-bind="click:Edit,attr:{disabled:!DataTable.SelectedModel()}"><i class="fa fa-pencil-square-o"></i>修改</button>
            <button class="btn btn-primary" data-bind="click:Delete,attr:{disabled:!DataTable.SelectedModel()}"><i class="fa fa-trash-o"></i>删除</button>
            <button class="btn btn-primary" data-bind="click:Add"><i class="fa fa-plus"></i>添加</button>
            <button class="btn btn-primary" data-bind="click:Detail,attr:{disabled:!DataTable.SelectedModel()}"><i class="fa fa-pencil-square-o"></i>详情</button>

        </div>
    </div>
    <div class="search">
        <table>
            <tr>
                <td>
                    <div class="input-group">
                        <input id="txt_keyword" type="text" class="form-control" placeholder="名称" style="width: 200px;" data-bind="value:SearchModel().keyword">
                        <span class="input-group-btn">
                            <button id="btn_search" type="button" class="btn  btn-primary" data-bind="click:Search"><i class="fa fa-search"></i></button>
                        </span>
                    </div>
                </td>
            </tr>
        </table>
    </div>
</div>

<div class="table-responsive">
    <table class="table table-hover" data-bind="with:DataTable">
        <thead>
            <tr>
                <th style="width: 20px;"></th>
                <th>名称</th>
                <th>值</th>
                <th>描述</th>
                <th>上级</th>
                <th>备注</th>
            </tr>
        </thead>

        <tbody data-bind="foreach:Models">
            <tr data-bind="click:$parent.SelectRow">
                <td data-bind="text:$parent.GetOrdinal($index())"></td>
                <td data-bind="text:propertyName"></td>
                <td data-bind="text:propertyValue"></td>
                <td data-bind="text:propertyMeaning"></td>
                <td data-bind="text:parentId"></td>
                <td data-bind="text:$ace.getFuzzyContent(remark()),attr:{herf:'#',title:remark}"></td>
            </tr>
        </tbody>
        @this.Partial("_tfoot")
    </table>
</div>


@using (Html.Dialog())
{
    <form id="form1">
        <div style="margin-top: 10px; margin-left: 10px; margin-right: 10px;">
            <div style="padding-top: 20px; margin-right: 30px;">
                <table class="form">
                    <tr>
                        <td class="formTitle">名称<span style="color:red;">*</span></td>
                        <td class="formValue">
                            <input id="propertyName" name="propertyName" type="text" class="form-control required" placeholder="请输入名称" data-bind="value:Model().propertyName" />
                        </td>
                        <td class="formTitle">值</td>
                        <td class="formValue">
                            <input id="propertyValue" name="propertyValue" type="text" class="form-control" placeholder="请输入值" data-bind="value:Model().propertyValue" />
                        </td>
                    </tr>
                    <tr>
                        <td class="formTitle">描述</td>
                        <td class="formValue">
                            <input id="propertyMeaning" name="propertyMeaning" type="text" class="form-control" data-bind="value:Model().propertyMeaning" />
                        </td>
                        @*<td class="formTitle">上级</td>
                        <td class="formValue">
                            <input id="parentId" name="parentId" type="text" class="form-control" data-bind="value:Model().parentId" />
                        </td>*@
                        <td class="formTitle" valign="top" style="padding-top: 5px;">备注
                        </td>
                        <td class="formValue">
                            <textarea id="remark" name="remark" class="form-control" style="height: 60px;" data-bind="value:Model().remark"></textarea>
                        </td>
                    </tr>
                   @* <tr>
                        <td class="formTitle" valign="top" style="padding-top: 5px;">备注
                        </td>
                        <td class="formValue" colspan="3">
                            <textarea id="remark" name="remark" class="form-control" style="height: 60px;" data-bind="value:Model().remark"></textarea>
                        </td>
                    </tr>*@
                </table>
            </div>
        </div>
    </form>


}
@using (Html.Dialog("DetailDialog", "DetailDialog", 800))
{
    <form id="DetailForm">
        <div style="margin-top: 10px; margin-left: 10px; margin-right: 10px;">
            <div style="padding-top: 20px; margin-right: 30px;">
                <table class="form">
                    <tr>
                        <td class="formTitle">名称：</td>
                        <td class="formValue">
                            @*<input id="propertyName1" name="propertyName" readonly="readonly" type="text" class="form-control" data-bind="value:Model().propertyName" />*@
                            <label class="form-control" data-bind="text:Model().propertyName"></label>
                        </td>
                        <td class="formTitle">值：</td>
                        <td class="formValue">
                            <label class="form-control" data-bind="text:Model().propertyValue"></label>
                        </td>
                    </tr>
                    <tr>
                        <td class="formTitle">描述：</td>
                        <td class="formValue">
                            <label class="form-control" data-bind="text:Model().propertyMeaning"></label>
                        </td>
                        @*<td class="formTitle">上级：</td>
                        <td class="formValue">
                            <label class="form-control" data-bind="text:Model().parentId"></label>
                        </td>*@
                        <td class="formTitle" valign="top" style="padding-top: 5px;">备注：
                        </td>
                        <td class="formValue">
                            <label class="form-control" data-bind="text:Model().remark"></label>
                        </td>
                    </tr>
                   @* <tr>
                        <td class="formTitle" valign="top" style="padding-top: 5px;">备注：
                        </td>
                        <td class="formValue" colspan="3">
                            <label class="form-control" data-bind="text:Model().remark"></label>
                        </td>
                    </tr>*@
                </table>
            </div>
        </div>
    </form>


}

